package com.spring.boot.rabbit.controller;

import com.spring.boot.rabbit.service.RabbitProducer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * RabbitController
 *
 * @author 李坤
 * @date 2022/9/1 13:52
 */
@RestController
@RequestMapping("/rabbit")
public class RabbitController {

    @Resource
    private RabbitProducer rabbitProducer;

    @GetMapping("/topic")
    public void topic() {
        rabbitProducer.sendMessage2Topic(LocalDateTime.now());
    }

    @GetMapping("/direct")
    public void direct() {
        rabbitProducer.sendMessage2Direct(LocalDateTime.now());
    }

}
